<section class="content">
    <div class="left-content">
        <span class="main-text">From</span>
        <span class="title-text">The Blog</span>
        <div class="desc">
            This is TecHouse's blog where we share our newest info about upcoming events and products of the 
            company.
        </div>
        <div id="posts">
        <?php if($this->db->count_all('posts') > 0): ?>
            <?php foreach($rows as $row): ?>
            <div class="post"> 
                <span class="post-title"><?php echo $row->title; ?></span>
                <small class="post-info"><?php echo $row->posted_on; ?> | Category Name | Author Name | 23 comments</small>
                <p class="post-content"><?php echo $row->content; ?></p>
                <a href="#" class="learn">Read More</a>
                <?php if($isAdmin): ?>
                <?php echo anchor('blog/removePost/'.$row->id, 'Remove Post', array(
                    'class' => 'learn'
                )); ?> 
                <?php echo anchor('blog/editPost/'.$row->id, 'Edit Post', array(
                    'class' => 'learn'
                )); ?> 
                <?php endif; ?>
            </div>
            <?php endforeach; 
                else:
            ?>
            <div class="post"> 
                <span class="post-title">No posts added currently!</span>
            </div>
            <?php endif; ?>
        </div>
        <?php if($isAdmin): ?>
            <div id="add">
                <a href="#" class="learn">Add Post</a>
            </div>
        <?php endif; ?>
    </div>
    <div class="right-content">
        <div class="widgets">
            <h3>Categories</h3>
            <ul>
                <?php
                    if(isset($rows_cat)):
                    foreach($rows_cat as $row):
                 ?>
                <li><?php if($isAdmin) echo anchor('blog/removeCategory/'.$row->id, 'X', array(
                    'style' => 'color: red;
                        margin-right: 20px;
                    '
                )); echo anchor('#', $row->category_name); ?></li>
                <?php 
                    endforeach;
                endif; ?>
            </ul>
            <div id="btns">
            <?php if($isAdmin): ?>
                <?php echo anchor('blog/addCategory', 'Add Category', array(
                    'class' => 'learn'
                )); ?>
            <?php endif; ?>
            </div>
        </div>
        <div class="widgets">
            <h3>Follow us</h3>
            <div id="images">
                <a href="#"><img src="images/fb.png" alt="Facebook"/></a>
                <a href="#"><img src="images/twitter.png" alt="Twitter"/></a>
            </div>
        </div>
    </div>
</section>
